package cloudGateway.config;

import cloudEntity.utils.ResultUtils;
import huang.cloudUserApi.AuthFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

/**
 * @program: Smart School
 * @ClassName CustomerLoginUserImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-04-11 09:16
 * @Version 1.0
 **/
@Service
public class CustomerLoginUserImpl implements ReactiveUserDetailsService {

    @Autowired
    private AuthFeignClient authApi;

    @Override
    public Mono<UserDetails> findByUsername(String username) {
        try
        {
            ResultUtils user = authApi.getUser(username);
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        return Mono.error(new UsernameNotFoundException("User Not Found"));
    }

}
